package cn.epsilon3.controller;


import cn.epsilon3.annotation.E3Des;
import cn.epsilon3.annotation.E3Log;
import cn.epsilon3.annotation.E3Service;
import cn.epsilon3.common.Result;
import cn.epsilon3.domain.e3.vo.E3CheckPasswordVO;
import cn.epsilon3.domain.e3.vo.FALoginVo;
import cn.epsilon3.domain.e3.vo.UserLoginVO;
import cn.epsilon3.service.user.E3UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * <p>
 * 系统用户 接口
 * </p>
 *
 * @author epsilon3
 * @since 2023-05-19
 */
@Api(tags = "E3-用户信息v0.0.3")
@E3Service(path = "/auth/user")
public class E3UserController {

    @Resource
    private E3UserService e3UserService;

    @E3Log
    @E3Des
    @ApiOperation("用户登陆")
    @PostMapping("/login.action")
    public Result<Object> e3UserLogin(@Valid UserLoginVO userLoginVO) {
        return e3UserService.e3UserLogin(userLoginVO);
    }

    @E3Log
    @ApiOperation("用户多因子验证登陆")
    @PostMapping("/2faLogin.action")
    public Result<Object> faLogin(@Valid @RequestBody FALoginVo faLoginVo) {
        return e3UserService.e3UserFALogin(faLoginVo);
    }

    @E3Log
    @PostMapping("/checkPassword.action")
    public Result<String> checkPassword(@Valid @RequestBody E3CheckPasswordVO e3CheckPasswordVO) {
        return e3UserService.e3CheckPassword(e3CheckPasswordVO);
    }

    @E3Log
    @PostMapping("/loginOut.action")
    public Result<String> e3UserLoginOut() {
        return e3UserService.e3UserLoginOut();
    }

}
